package com.ryan.banner.controller.front;

import com.ryan.banner.entity.Banner;
import com.ryan.banner.service.BannerService;
import com.ryan.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 前台页面的banner控制器
 */
@RestController
@RequestMapping("/banner/front")
public class FrontBannerController {

    @Autowired
    private BannerService bannerService;

    /**
     * 获取已选中的轮播图
     * @return
     */
    @GetMapping("/getIndexBanner")
    public R getIndexBanner(){
        List<Banner> bannerList = bannerService.getIndexBanner();
        return R.ok().data("bannerList", bannerList);
    }

}
